<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="bannerImg[0]" alt="" />
      <div class="banner-info">
        <div class="banner-title">{{ this.sightName[0] }}</div>
        <div class="banner-number">
          <span class="iconfont banner-icon">&#xe629;</span>
          {{ this.gallaryImgs.length }}
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary
        :imgs="gallaryImgs"
        v-show="showGallary"
        @close="handleGallaryClose"
      ></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from "common/gallary/Gallary.vue";
import FadeAnimation from "common/fade/Fade.vue";
export default {
  name: "DetailBanner",
  components: {
    CommonGallary,
    FadeAnimation,
  },
  props: {
    gallaryImgs: Array,
    sightName: Array,
    bannerImg: Array,
  },
  data() {
    return {
      showGallary: false,
    };
  },
  methods: {
    handleBannerClick() {
      this.showGallary = true;
    },
    handleGallaryClose() {
      this.showGallary = false;
    },
  },
};
</script>

<style lang='stylus' scoped>
.banner {
  overflow: hidden;
  height: 0;
  padding-bottom: 55%;
  position: relative;
}

.banner-img {
  width: 100%;
}

.banner-info {
  position: absolute;
  right: 0;
  left: 0;
  bottom: 0;
  display: flex;
  line-height: 0.6rem;
  color: #fff;
  text-align: left;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
}

.banner-title {
  flex: 1;
  font-size: 0.32rem;
  padding: 0.2rem;
}

.banner-number {
  margin-top: 0.35rem;
  padding: 0 0.4rem;
  height: 0.32rem;
  line-height: 0.32rem;
  border-radius: 0.2rem;
  background: rgba(0, 0, 0, 0.8);
  font-size: 0.24rem;
}

.banner-icon {
  font-size: 0.24rem;
}
</style>